package com.ybwh.datasource.refreshable.spring.boot;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 类的说明
 * </p>
 *
 * @author fanbeibei
 * @version V1.0
 * @since 2019/4/8 19:06
 */
public class SpringBootConfigurationCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String url = context.getEnvironment().getProperty("refreshable.sharding.jdbc.datasource.names");
        if (StringUtils.hasText(url)) {
            return true;
        }

        return false;
    }
}
